/**
 * 人事评估意见
 */
import React from 'react';
import { Typography, Form, Radio, Button } from 'antd';
import FileUpload from '@/components/Custom/FileUpload';
import LimitInput from '@/components/LimitInput';
import { FormContent, FormLayout } from '../../components';
import { requireRule } from '../../utils';

const options = [
    { label: '合格', value: '1' },
    { label: '需观察', value: '2' },
    { label: '不合格', value: '0' }
];

export default function AssessHR({ form }) {
    const { getFieldDecorator } = form;
    return (
        <div>
            <FormContent>
                <Typography.Paragraph type="secondary">
                    请评估该员工在规章制度、道德规范、职业操守等方便的表现，并反馈异常情况
                </Typography.Paragraph>
            </FormContent>
            <div style={{ width: 900 }}>
                <FormLayout type="full">
                    <Form.Item label="人事评价">
                        {getFieldDecorator('evaluationType', {
                            initialValue: '1'
                        })(<Radio.Group options={options} />)}
                    </Form.Item>
                </FormLayout>
                <FormLayout type="full">
                    <Form.Item label="评价说明">
                        {getFieldDecorator('opinion', { rules: requireRule('请输入评价说明') })(
                            <LimitInput area rows={7} placeholder="请输入" maxLength={500} />
                            // <Input.TextArea maxLength={500} rows={7} placeholder="请输入" />
                        )}
                    </Form.Item>
                </FormLayout>
                <FormLayout type="full">
                    <Form.Item label="注意事项" extra="评估完成后将提醒新员工查看">
                        {getFieldDecorator('announcements', { rules: requireRule('请输入注意事项') })(
                            <LimitInput area rows={7} placeholder="请输入" maxLength={500} />
                            // <Input.TextArea maxLength={500} rows={7} placeholder="请输入" />
                        )}
                    </Form.Item>
                </FormLayout>
                <FormLayout type="full">
                    <Form.Item
                        label="附件"
                        help="支持 pdf、doc(x)、xls(x)、jp(e)g、png、rar 等格式的附件，单个文件大小为10MB以内"
                    >
                        {getFieldDecorator('resourceRelation')(
                            <FileUpload
                                categoryCode="probationAssessFile"
                                checkFileSize={10}
                                maxFileCount={1}
                                checkFileType="pdf、doc、docx、jpg、jpeg、png、rar、xls、xlsx"
                                checkFileTypeMsg="只能上传 pdf、doc(x)、xls(x)、jp(e)g、png、rar 格式的文件！"
                                checkFileSizeMsg="文件大小不能超过10MB！"
                            >
                                <Button>上传文件</Button>
                            </FileUpload>
                        )}
                    </Form.Item>
                </FormLayout>
            </div>
        </div>
    );
}
